package com.nearby.demand.presenter;

import android.graphics.Bitmap;

import com.nearby.demand.interactor.OnSplashListener;
import com.nearby.demand.interactor.SplashInteractorImpl;
import com.nearby.demand.ui.view.SplashView;

/**
 * Created by IME on 2016/home_1/10.
 */
public class SplashPersenterImpl implements SplashPersenter, OnSplashListener {

    private SplashView view;
    private SplashInteractorImpl interactor;

    public SplashPersenterImpl(SplashView view) {
        this.view = view;
        interactor = new SplashInteractorImpl();
    }

    @Override
    public void isRequest() {
        if (view.isRequest()) {
            interactor.requestSplashImage(this);
        }
    }

    @Override
    public void onError() {
        view.showImage(null);
    }

    @Override
    public void onSuccess(Bitmap bitmap) {
        view.showImage(bitmap);
    }
}
